package cn.roadtrip.mtravelbusinessmodule.mvc.wrapper;

import cn.roadtrip.mtravelbusinessmodule.util.api.ins.InsuranceImpl;
import cn.roadtrip.mtravelbusinessmodule.util.api.ins.model.InsData;
import cn.roadtrip.mtravelbusinessmodule.util.api.ins.model.TrialOrderPriceRequest;
import cn.roadtrip.utilmodule.util.DataBean;
import cn.roadtrip.utilmodule.util.ValidControllerAnn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ins")
public class InsuranceController {

    @Autowired
    private InsuranceImpl insuranceImpl;

    /**
     * 创建保单
     *
     * @param insData
     * @return
     */
    @PostMapping("/createInsurane")
    @ValidControllerAnn
    public String createInsurane(@RequestBody InsData insData) {
        return insuranceImpl.createInsurane(insData);
    }

    /**
     * 获取产品列表
     *
     * @return
     */
    @PostMapping("/getProductList")
    @ValidControllerAnn
    public String getProductList() {
        return insuranceImpl.getProductList();
    }


    /**
     * 计算费用
     *
     * @return
     */
    @PostMapping("/calOrderPrice")
    @ValidControllerAnn
    public String calOrderPrice(@RequestBody TrialOrderPriceRequest model) {
        return insuranceImpl.calOrderPrice(model);
    }

    /**
     * 计算费用
     *
     * @return
     */
    @PostMapping("/getInsuranceDetail")
    @ValidControllerAnn
    public DataBean getInsuranceDetail(@RequestBody InsuranceImpl.ModelgetInsuranceDetail model) {
        return insuranceImpl.getInsuranceDetail(model);
    }

}
